package entity

import "mime/multipart"

// GetFileUri 获取文件请求
type GetFileUri struct {
	DCI string `uri:"dci" binding:"required" path:"dci" required:"true" example:"0x3e6cf1025bc0852b7141ab19a097305a3935ebb9cc23d4f507c6ccce112be73c"`
}

// GetCertificateUri 获取证书请求
type GetCertificateUri struct {
	DCI string `uri:"dci" binding:"required" path:"dci" required:"true" example:"0x3e6cf1025bc0852b7141ab19a097305a3935ebb9cc23d4f507c6ccce112be73c"`
}

// ItemData 作品的详细信息
type ItemData struct {
	DCI         string `json:"dci" required:"true" example:"0x3e6cf1025bc0852b7141ab19a097305a3935ebb9cc23d4f507c6ccce112be73c"`
	Name        string `json:"name" required:"true" example:"作品名称"`         // 作品名称
	Description string `json:"description,omitempty" example:"作品介绍"`        // 作品描述
	Category    string `json:"category"  example:"image"`                   // 作品类型
	FileName    string `json:"fileName" required:"true" example:"test.png"` // 上传文件名称
	FileSize    uint   `json:"fileSize" required:"true" example:"10000000"` // 上传文件大小
	FileType    string `json:"fileType" required:"true" example:"png"`      // 上传文件类型
}

// GetItemDataUri 获取作品详细信息请求
type GetItemDataUri struct {
	DCI string `uri:"dci" binding:"required" path:"dci" required:"true" example:"0x3e6cf1025bc0852b7141ab19a097305a3935ebb9cc23d4f507c6ccce112be73c"`
}

// ResponseItemData 获取作品详细信息响应
type ResponseItemData struct {
	Response
	Data ItemData `json:"data,omitempty"`
}

// UploadItemForm 上传作品文件
type UploadItemForm struct {
	Address     string `form:"address" binding:"required" formData:"address" required:"true" example:"0xfC97a1A683FB0108299D5725BC9d72899C9A86B4"`
	Signature   string `form:"signature" binding:"required" formData:"signature" required:"true" example:"0xb61f05a0f610179bcba3d706c173cf41259762bd483242a318c370fe4b5db8b228b045faf2f0f7e1e87276f478193a3ccb88ec972a5a2c4d874c3367368730a01c"`
	Name        string `form:"name" binding:"required" formData:"name" required:"true" example:"作品名称"`             // 作品名称
	Description string `form:"description" formData:"description" example:"作品介绍"`                                  // 作品描述
	Category    string `form:"category"  formData:"category" required:"true" example:"image"`                      // 作品类型
	FileName    string `form:"fileName" binding:"required" formData:"fileName" required:"true" example:"test.png"` // 上传文件名称
	FileSize    uint   `form:"fileSize" binding:"required" formData:"fileSize" required:"true" example:"10000000"` // 上传文件大小
	FileType    string `form:"fileType" binding:"required" formData:"fileType" required:"true" example:"png"`      // 上传文件类型
	IsSave      bool   `form:"isSave" binding:"required" formData:"isSave" required:"true" example:"true"`

	File *multipart.FileHeader `form:"file" binding:"required" formData:"file" required:"true"`
}

// GetItemUri 获取 Item 请求
type GetItemUri struct {
	DCI string `uri:"dci" binding:"required" path:"dci" required:"true" example:"0x3e6cf1025bc0852b7141ab19a097305a3935ebb9cc23d4f507c6ccce112be73c"`
}

type GetItemResponse struct {
	Response
	Data Item `json:"data,omitempty"`
}

type GetItemsQuery struct {
	Pagination
	BlockTimeSearch
	NameSearch
	Address string `form:"address" binding:"required" query:"address" example:"0xfC97a1A683FB0108299D5725BC9d72899C9A86B4"`
	Type    string `form:"type" binding:"required" query:"type" example:"in"` // create in out
}

type GetItemsResponse struct {
	Response
	Data []Item `json:"data,omitempty" `
}

// Item 作品信息包括链上相关的内容
type Item struct {
	DCI             string `json:"dci,omitempty" required:"true" example:"0x3e6cf1025bc0852b7141ab19a097305a3935ebb9cc23d4f507c6ccce112be73c"` // 数字指纹
	Name            string `json:"name,omitempty" required:"true" example:"作品名称"`                                                              // 作品名称
	Description     string `json:"description,omitempty" example:"作品描述"`                                                                       // 作品描述
	Category        string `json:"category,omitempty" required:"true" example:"image"`                                                         // 作品类型 other:其他 text:文本 video:视频 image:图片
	CreatorAddress  string `json:"creatorAddress,omitempty" required:"true" example:"0xfC97a1A683FB0108299D5725BC9d72899C9A86B4"`              // 作品创建者地址
	CreatorUsername string `json:"creatorUsername,omitempty" example:"Gan"`                                                                    // 作品创建者用户名
	OwnerAddress    string `json:"ownerAddress,omitempty" required:"true" example:"0xfC97a1A683FB0108299D5725BC9d72899C9A86B4"`                // 作品拥有者地址
	OwnerUsername   string `json:"ownerUsername,omitempty" example:"Gan"`                                                                      // 作品拥有者用户名

	ContractAddress string `json:"contractAddress,omitempty" example:"0xfC97a1A683FB0108299D5725BC9d72899C9A86B4"`
	ApprovalAddress string `json:"approvalAddress,omitempty" example:"0xfC97a1A683FB0108299D5725BC9d72899C9A86B4"`

	TxHash          string `json:"txHash,omitempty" required:"true" example:"0xfC97a1A683FB0108299D5725BC9d72899C9A86B4"`
	BlockNumber     uint64 `json:"blockNumber,omitempty" required:"true" example:"1"`
	BlockTime       uint64 `json:"blockTime,omitempty" required:"true" example:"14000000"`
	BlockTimeString string `json:"blockTimeString,omitempty" required:"true" example:"2020-01-01 01:01:01"`
}

// ItemEvent 代表传输格式的作品事件对象
type ItemEvent struct {
	TxHash      string `json:"txHash" required:"true" example:"0xa9b58a17f5ad7f510a1a33e313318cb8ba9f73c702409a2da90280ff65730624"`
	DCI         string `json:"dci" required:"true" example:"0x3e6cf1025bc0852b7141ab19a097305a3935ebb9cc23d4f507c6ccce112be73c"` // 数字指纹
	From        string `json:"from" required:"true" example:"0xfC97a1A683FB0108299D5725BC9d72899C9A86B4"`
	To          string `json:"to" required:"true" example:"0xfC97a1A683FB0108299D5725BC9d72899C9A86B4"`
	EventName   string `json:"eventName" required:"true" example:"create"`
	BlockNumber string `json:"blockNumber" required:"true" example:"1"`
	BlockTime   string `json:"blockTime" required:"true" example:"14000000"`
}

// GetItemEventsResponse Account 请求返回
type GetItemEventsResponse struct {
	Response
	Data []ItemEvent `json:"data,omitempty"`
}

type GetItemEventQuery struct {
	Pagination
	//Creator string `json:"dci" binding:"-" query:"dci" example:"0xfC97a1A683FB0108299D5725BC9d72899C9A86B4"`
	//Owner   string `form:"ownerAddress" binding:"-" query:"ownerAddress" json:"ownerAddress" example:"0xfC97a1A683FB0108299D5725BC9d72899C9A86B4"`
}

type GetItemEventsQuery struct {
	Pagination
	BlockTimeSearch
	From      string `form:"from" binding:"-" query:"from" example:"0xfC97a1A683FB0108299D5725BC9d72899C9A86B4"`
	To        string `form:"to" binding:"-" query:"to" example:"0xfC97a1A683FB0108299D5725BC9d72899C9A86B4"`
	EventName string `form:"eventName" binding:"-" query:"eventName" example:"create"`
	DCI       string `form:"dci" binding:"-" query:"dci" example:"0x695e73b4c6f733113e59357c7abaea15be64bff002e5091c344523acf055c15f"`
}

type GetItemPicturesUri struct {
	DCI string `uri:"dci" binding:"required" path:"dci" required:"true" example:"0x3e6cf1025bc0852b7141ab19a097305a3935ebb9cc23d4f507c6ccce112be73c"`
}
